<!--行业信息-->
<div class="tab-pane fade" id="tab-industry" >
	  	<div class="form-horizontal">
		    <ul class="nav nav-tabs">
			  <li class="active"><a href="#technologies" data-toggle="tab" aria-expanded="true"><span class="lb-1">人员</span></a></li>
			  <li class=""><a href="#devices" data-toggle="tab" aria-expanded="false"><span class="lb-2">设备</span></a></li>
			  <li class=""><a href="#history_project" data-toggle="tab" aria-expanded="false"><span class="lb-3">近年开展的项目</span></a></li>
			</ul>
			<div id="myTabContent" class="tab-content">
			  <div class="tab-pane fade active in" id="technologies">
				<table class="table user-list" id="personList">
					<thead>
						<tr>
							<th data-column-id="id"><span>ID</span></th>
							<th data-column-id="real_name" data-sortable="false"><span>姓名</span></th>
							<th data-column-id="gender" data-formatter="gender" data-sortable="false"><span>性别</span></th>
							<th data-column-id="education" data-sortable="false"><span>学历</span></th>
							<th data-column-id="profession" data-sortable="false"><span>专业</span></th>
							<th data-column-id="job" data-sortable="false"><span>职称</span></th>
							<th data-sortable="false" data-formatter="commands"><span>操作</span></th>

						</tr>
					</thead>
					<tbody>
					</tbody>
				</table>

	  			<button class="btn btn-primary pull_left" type="button" id="add_artisan"><i class="fa fa-pencil-square-o"></i> 添 加 </button>


			  </div>
			  <div class="tab-pane fade" id="devices">
				<table class="table user-list" id="devicesList">
					<thead>
						<tr>
							<th data-column-id="name" data-sortable="false"><span>设备名称</span></th>
							<th data-column-id="num" data-sortable="false"><span>设备台数</span></th>
							<th data-column-id="functions" data-sortable="false"><span>测试功能</span></th>
							<th data-column-id="creator" data-sortable="false"><span>制造商</span></th>
							<th data-column-id="product_time" data-sortable="false"><span>生产日期</span></th>
							<th data-column-id="created_at" data-sortable="false"><span>发布日期</span></th>
							<th data-sortable="false" data-formatter="device"><span>操作</span></th>

						</tr>
					</thead>
					<tbody>
					</tbody>
				</table>
	  			<button class="btn btn-primary pull_left" type="button" id="add_instrument"><i class="fa fa-pencil-square-o"></i> 添 加 </button>

				<div class="row text-center">
				</div>
			  </div>
				<div class="tab-pane fade" id="history_project">
					<table class="table user-list" id="projectList">
						<thead>
							<tr>
								<th data-column-id="name" data-sortable="false"><span>项目名称</span></th>
								<th data-column-id="master" data-sortable="false"><span>委托单位</span></th>
								<th data-column-id="start_time" data-sortable="false"><span>开始时间</span></th>
								<th data-column-id="end_time" data-sortable="false"><span>结束时间</span></th>
								<th data-sortable="false" data-formatter="history"><span>操作</span></th>
							</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<button class="btn btn-primary pull_left" type="button" id="add_projects"><i class="fa fa-pencil-square-o"></i> 添 加 </button>
					<div class="row text-center">
					</div>
			  	</div>
			</div>
		</div>
</div>


<script type="text/javascript">
	var labelsSetting = {
		infos: "当前第 {{ctx.start}} 条 到 {{ctx.end}} 条 共 {{ctx.total}} 条数据",
		search: "搜索",
		loading: "正在加载...",
		noResults: "未找到您要的数据...",
		refresh: "刷新",
		all: "全部"
	};
	$("#personList").bootgrid({
		rowCount: [10, 25, 50],
	    ajax:true,
	    url: "third_person_list?uid="+uid+"",
	    labels:labelsSetting,
	    formatters: {
	    	"commands": function(k,row){
	    		return '<a href="javascript:void(0);" pid="'+row.id+'" class="table-link edit_artisan"><span class="fa-stack"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-pencil fa-stack-1x fa-inverse"></i></span></a>' + '<a href="javascript:void(0);" pid="'+row.id+'" class="table-link del_artisan"><span class="fa-stack"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-search-plus fa-stack-1x fa-inverse"></i></span></a>';
	    	},
	    	"gender": function(k, v){
	    		if(v.gender == 0){
	    			return '女';
	    		}
	    		return "男";
	    	}
	    }
	}).on("loaded.rs.jquery.bootgrid", function (e)
    {
    	$(".edit_artisan").bind("click", function(){
    		var pid = $(this).attr("pid");
    		window.location.href="edit_artisan?pid="+pid;
    	})

    	$(".del_artisan").bind("click", function(){
    		var pid = $(this).attr("pid");

    		confirm('','确定要删除吗？','warning',function (data){
    			if(data == 1){
    				$.post("edit_artisan/delete", {pid : pid}, function(data){
    					if(data.success){
    						success("", "删除成功");
    						setTimeout(function(){
    							window.location.reload();
    						}, 1000)
    					}
    				})
    			}
    		})
    	})
    });

	$("#devicesList").bootgrid({
		rowCount: [10, 25, 50],
	    ajax:true,
	    url: "third_device_list?uid="+uid+"",
	    labels:labelsSetting,
	    formatters: {
	    	"device": function(k,row){
	    		return '<a href="javascript:void(0);" tid="'+row.id+'" class="table-link edit_device"><span class="fa-stack"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-pencil fa-stack-1x fa-inverse"></i></span></a>' + '<a href="javascript:void(0);" tid="'+row.id+'" class="table-link del_device"><span class="fa-stack"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-search-plus fa-stack-1x fa-inverse"></i></span></a>';
	    	}
	    }
	}).on("loaded.rs.jquery.bootgrid", function (e)
    {
    	$(".edit_device").bind("click", function(){
    		var tid = $(this).attr("tid");
    		window.location.href="edit_instrument?tid="+tid;
    	})

    	$(".del_device").bind("click", function(){
    		var tid = $(this).attr("tid");
    		confirm('','确定要删除吗？','warning',function (data){
    			if(data == 1){
    				$.post("edit_instrument/delete", {tid : tid}, function(data){
    					if(data.success){
    						success("", "删除成功");
    						setTimeout(function(){
    							window.location.reload();
    						}, 1000)
    					}
    				})
    			}
    		})


    	})
    });



	$("#projectList").bootgrid({
		rowCount: [10, 25, 50],
	    ajax:true,
	    url: "third_project_list?uid="+uid+"",
	    labels:labelsSetting,
	    formatters: {
	    	"history": function(k,row){
	    		return '<a href="javascript:void(0);" hid="'+row.id+'" class="table-link edit_history"><span class="fa-stack"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-pencil fa-stack-1x fa-inverse"></i></span></a>' + '<a href="javascript:void(0);" hid="'+row.id+'" class="table-link del_history"><span class="fa-stack"><i class="fa fa-square fa-stack-2x"></i><i class="fa fa-search-plus fa-stack-1x fa-inverse"></i></span></a>';
	    	}
	    }
	}).on("loaded.rs.jquery.bootgrid", function (e)
    {
    	$(".edit_history").bind("click", function(){
    		var hid = $(this).attr("hid");
    		window.location.href="edit_projects?hid="+hid;
    	});

    	$(".del_history").bind("click", function(){
    		var hid = $(this).attr("hid");
    		confirm('','确定要删除吗？','warning',function (data){
    			if(data == 1){
    				$.post("edit_projects/delete", {hid : hid}, function(data){
    					if(data.success){
    						success("", "删除成功");
    						setTimeout(function(){
    							window.location.reload();
    						}, 1000)
    					}
    				})
    			}
    		})
    	})
    });


    $("#add_artisan").bind("click", function(){
    	window.location.href="edit_artisan?uid="+uid;
    })

    $("#add_instrument").bind("click", function(){
    	window.location.href="edit_instrument?uid="+uid;
    })

    $("#add_projects").bind("click", function(){
    	window.location.href="edit_projects?uid="+uid;
    })

	$(".input-group").hide();
    $(".btn-group").hide();
</script>